import {defineStore} from 'pinia'
import {ElMessage} from "element-plus";

// 定义用户状态管理store
export const useCommonLocalStore = defineStore('commonLocalStore', {
    // 持久化配置
    persist: {
        key: 'commonLocalStore',
        storage: localStorage,
        paths: ['openAsideMenu'] // 只持久化userInfo和token字段
    },

    // 状态定义
    state: () => ({
        openAsideMenu: true
    }),

    // 计算属性
    getters: {},

    // 方法定义
    actions: {
        changeOpenAsideMenu() {
            this.openAsideMenu = !this.openAsideMenu
        }
    }
})